package com.matrix.java.chap_03.example;

import java.util.Scanner;

/**
 * ComputeAndInterpretBMI
 *
 * @since 2021-10-22-11:17
 */
public class Case3_04 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.print("输入体重,身高: ");
        double weight = input.nextDouble();
        double height = input.nextDouble();
        if (weight <= 0 || height <= 0) {
            System.out.println("请重新输入");
        } else {
            double BMI;
            BMI = weight / Math.pow(height, 2);
            System.out.println(BMI);
            if (BMI < 18.5) {
                System.out.println("1");
            } else if (BMI < 25.0) {
                System.out.println("2");
            } else if (BMI < 30.0) {
                System.out.println("3");
            } else{
                System.out.println("4");
            }

            input.close();
        }
    }
}